package com.SouthernWall_404.age_tool.common.init;


import com.SouthernWall_404.age_tool.AgeTool;
//import com.SouthernWall_404.age_tool.common.world.block.RedStoneComponent.AbstractRedstoneComponent;
//import com.SouthernWall_404.age_tool.common.world.block.RedStoneComponent.GateBlock.AndGateBlock;
import com.SouthernWall_404.age_tool.common.world.block.RedStoneComponent.ExcuteBlock;
import com.SouthernWall_404.age_tool.common.world.block.MusicBlock;
import com.SouthernWall_404.age_tool.common.world.block.TriggerBlocks.LeftClickTriggerBlock;
import com.SouthernWall_404.age_tool.common.world.block.TriggerBlocks.RightClickTriggerBlock;
import com.google.common.collect.Sets;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;

import java.util.LinkedHashSet;
import java.util.function.Supplier;

public class ModBlocks {
    public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, AgeTool.MODID);


    public static LinkedHashSet<RegistryObject<Block>> CREATIVE_TAB_BLOCKS = Sets.newLinkedHashSet();
    
    public static RegistryObject<Block> quickRegisterWithTab(final String name, final Supplier<Block> supplier) {
        RegistryObject<Block> item = BLOCKS.register(name, supplier);
        CREATIVE_TAB_BLOCKS.add(item);
        ModItems.registerWithTab(name+"_item",()->new BlockItem(item.get(),new Item.Properties()));
        return item;
    }
    public static RegistryObject<Block> vanillaRegister(final String name, final Supplier<Block> supplier) {
        RegistryObject<Block> item = BLOCKS.register(name, supplier);
//        CREATIVE_TAB_BLOCKS.add(item);
//        return item;

        return item;
    }
    public static RegistryObject<Block> RADIO_BLOCK = quickRegisterWithTab("radio_block", ()->new MusicBlock(BlockBehaviour.Properties.copy(Blocks.BEDROCK)
            .noOcclusion()  // 禁用默认碰撞箱
            .dynamicShape()));
    public static RegistryObject<Block> RIGHT_CLICK_TRIGGER_BLOCK = quickRegisterWithTab("right_click_trigger_block", ()->new RightClickTriggerBlock(BlockBehaviour.Properties.copy(Blocks.BEDROCK)));
//    public static RegistryObject<Block> LEFT_CLICK_TRIGGER_BLOCK = quickRegisterWithTab("left_click_trigger_block", ()->new LeftClickTriggerBlock(BlockBehaviour.Properties.copy(Blocks.BEDROCK)));
    public static RegistryObject<Block> EXCUTER= vanillaRegister("excuter_block",()->new ExcuteBlock(BlockBehaviour.Properties.copy(Blocks.BEDROCK)));

//        public static RegistryObject<Block> AND_GATE_BLOCK = quickRegisterWithTab("and_gate_block",()->new AndGateBlock(BlockBehaviour.Properties.of()));
//    public static RegistryObject<Block> OR_GATE_BLOCK = quickRegisterWithTab("or_gate_block",()->new OrGateBlock(BlockBehaviour.Properties.of()));
//    public static RegistryObject<Block> NOT_GATE_BLOCK = quickRegisterWithTab("not_gate_block",()->new NotGateBlock(BlockBehaviour.Properties.of()));
    public static RegistryObject<Block> RIGHTCLICK_TRIGGER_DISPLAY_BLOCK = vanillaRegister("right_click_trigger_display_block",()->new Block(BlockBehaviour.Properties.copy(Blocks.BEDROCK)));
//    public static RegistryObject<Block> LEFT_CLICK_TRIGGER_DISPLAY_BLOCK = vanillaRegister("left_click_trigger_display_block",()->new Block(BlockBehaviour.Properties.copy(Blocks.BEDROCK)));

}
